<template>
  <div class="content_box">
    <div class="content_left">
      <div class="content_left_title public_card">项目名称1111</div>
      <div class="content_left_ul public_card">
        <div class="header">
          <img />
          <div class="header_title">
            <div>实例分割</div>
            <div>轴对齐边界框</div>
          </div>
        </div>
        <div class="split_box">
          <div style="position: sticky;top: 0;background-color: #fff;z-index: 1;padding-top: 14px;">
            <div class="split_title">拆分</div>
            <div @click="carterSplit" class="carter_split">创建拆分</div>
          </div>
          <div v-for="(item, index) in splitData" :key="index" class="split_item">
            <div class="split_item_title">
              <div>{{ item.title }}</div>
              <div class="split_item_actions">
                <img @click="handleCommentClick(index, $event)" src="../static/images/split/comment.png" class="comment-img">
                <img @click="carterSplit" src="../static/images/split/more.png">
                <div v-if="showPopconfirm === index" class="custom-popconfirm">
                  <div class="popconfirm-arrow"></div>
                  <div class="popconfirm-content">
                    <div class="popconfirm-content-title">拆分评论</div>
                    <textarea class="popconfirm-content-txt" placeholder="请输入" />
                    <div class="popconfirm-content-btn">
                      <div @click="closePopconfirm" class="popconfirm-content-btn-cancel">取消</div>
                      <div @click="closePopconfirm" class="popconfirm-content-btn-submit">确定</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="split_s">
              <div :ref="el => setPieRef(el, index)" class="split_pie"></div>
              <div class="split_txt">
                <div style="margin-bottom: 10px;">{{ item.percentage }}</div>
                <div>
                  <div>{{ item.images }}</div>
                  <div>{{ item.instances }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="content_right">
      <div class="content_right_top">
        <div class="public_card content_right_top_left">
          <div class="content_right_title">数据拆分细节</div>
          <div class="content_right_form">
            <div class="label">拆分名称：</div>
            <input placeholder="请输入" />
          </div>
          <div class="content_right_top_left_s">
            <div class="content_right_table">
              <div class="thead">
                <div>数据集</div>
                <div>实例</div>
                <div>图像</div>
              </div>
              <div class="scroll_h">
                <div v-for="item in 3" :key="item" class="tr">
                  <div>训练</div>
                  <div>2(100%)</div>
                  <div>9(100%)</div>
                </div>
              </div>
              <div class="thead">
                <div>拆分集中的总数</div>
                <div>2</div>
                <div>2</div>
              </div>
            </div>
            <div class="content_right_top_left_pie" ref="rightPieRef"></div>
          </div>
        </div>
        <div class="public_card content_right_top_right">
          <div class="content_right_title">于训练中使用</div>
          <div class="content_right_top_right_table_thead">
            <div>训练名称</div>
            <div>状况</div>
          </div>
          <div class="scroll_h">
            <div class="tr">
              <div>训练-250503-100342</div>
              <div>已完成</div>
            </div>
          </div>
          <div class="tip_err">
            <img src="../static/images/split/tip-err.png">
            <div class="tip_err_txt">本拆分将用于以上的训练中，不能被修改</div>
          </div>
        </div>
      </div>
      <div class="content_bottom public_card">
        <div class="content_right_title">类别分布详情</div>
        <div class="content_bottom_thead">
          <div class="flex1">
            <div>类别名称</div>
            <el-icon size="12">
              <DCaret />
            </el-icon>
          </div>
          <div class="flex1">
            <div>实例分布</div>
            <el-icon size="12">
              <DCaret />
            </el-icon>
          </div>
          <div class="flex1">
            <div>图像分布</div>
            <el-icon size="12">
              <DCaret />
            </el-icon>
          </div>
        </div>
        <div class="ov_h">
          <div v-for="(category, index) in categoryData" :key="index" class="content_bottom_tr">
            <div class="category_name">
              {{ category.name }}
            </div>
            <div class="distribution_column">
              <div class="distribution_value">
                {{ formatDisplayValue(category.instanceDistribution.segments) }}
              </div>
              <div class="progress_bar_container">
                <div class="progress_bar">
                  <div v-for="(segment, segIndex) in category.instanceDistribution.segments" :key="segIndex"
                    class="progress_segment" :style="{
                      width: calculateSegmentWidth(segment, category.instanceDistribution.total) + '%',
                      backgroundColor: segment.color
                    }"></div>
                </div>
              </div>
            </div>
            <div class="distribution_column">
              <div class="distribution_value">
                {{ formatDisplayValue(category.imageDistribution.segments) }}
              </div>
              <div class="progress_bar_container">
                <div class="progress_bar">
                  <div v-for="(segment, segIndex) in category.imageDistribution.segments" :key="segIndex"
                    class="progress_segment" :style="{
                      width: calculateSegmentWidth(segment, category.imageDistribution.total) + '%',
                      backgroundColor: segment.color
                    }"></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <el-dialog v-model="showSplitDialog" title="创建拆分" width="760px">
    <div class="split_dialog">
      <div class="dialog_form">
        <div>拆分名称：</div>
        <input placeholder="请输入" />
      </div>
      <div class="dialog_center">
        <div class="dialog_center_pie" ref="dialogPieRef"></div>
        <div class="dialog_center_right">
          <div class="dialog_center_right_st">
            <div>图像</div>
            <div>13</div>
          </div>
          <div class="dialog_center_table">
            <div class="dialog_center_table_th">
              <div>图形</div>
              <div>百分比</div>
            </div>
            <div v-for="item in 3" :key="item" class="dialog_center_table_td">
              <div class="dialog_center_table_item">
                <div class="jian">
                  <img src="../static/images/split/jian.png" />
                </div>
                <div class="num">1</div>
                <div class="jia">
                  <img src="../static/images/split/jia.png" />
                </div>
              </div>
              <div class="dialog_center_table_item">
                <div class="jian">
                  <img src="../static/images/split/jian.png" />
                </div>
                <div class="num">1</div>
                <div class="jia">
                  <img src="../static/images/split/jia.png" />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="dialog_setting">
        <el-checkbox v-model="checked1" size="large" />
        <div class="label">设置一个用户自定义的随机种子</div>
        <div class="dialog_center_table_item">
          <div class="jian">
            <img src="../static/images/split/jian.png" />
          </div>
          <div class="num">1</div>
          <div class="jia">
            <img src="../static/images/split/jia.png" />
          </div>
        </div>
      </div>
      <div class="dialog_footer">
        <div @click="closeDialog" class="dialog_footer_cancel">取消</div>
        <div @click="closeDialog" class="dialog_footer_carter">创建拆分和应用分配</div>
      </div>
    </div>
  </el-dialog>
</template>

<script setup>
import * as echarts from 'echarts'
import { ref, onMounted, nextTick, onUnmounted } from 'vue'

// 存储多个饼图的 ref
const pieRefs = ref([])
// 右侧饼图的 ref
const rightPieRef = ref(null)
// 弹窗饼图的 ref
const dialogPieRef = ref(null)

// 弹窗状态管理
const showSplitDialog = ref(false)
// popconfirm状态管理 (-1表示不显示，>=0表示显示对应索引的popconfirm)
const showPopconfirm = ref(-1)
// 存储弹出框位置信息
const popconfirmPosition = ref({ top: 0, left: 0 })

const checked1 = ref(false)

// 示例数据
const splitData = ref([
  {
    title: '拆分-250702-123321',
    percentage: '69·15·15%',
    images: '13个图像(100%)',
    instances: '4个实例(100%)',
    chartData: [
      { value: 69, name: '训练集', color: '#2165F8' },
      { value: 15, name: '验证集', color: '#FA8B14' },
    ]
  },
  {
    title: '拆分-250702-456789',
    percentage: '80·10·10%',
    images: '20个图像(100%)',
    instances: '8个实例(100%)',
    chartData: [
      { value: 80, name: '训练集', color: '#2165F8' },
      { value: 10, name: '验证集', color: '#FA8B14' },
    ]
  }
])

// 右侧饼图数据（基于表格数据）
const rightPieData = ref([
  { value: 80, name: '训练集', color: '#2165F8' },
  { value: 10, name: '验证集', color: '#FA8B14' },
])

// 弹窗饼图数据
const dialogPieData = ref([
  { value: 70, name: '训练', color: '#2165F8' },
  { value: 15, name: '验证', color: '#FA8B14' },
  { value: 15, name: '测试', color: '#5AD8A6' }
])

// 类别分布数据
const categoryData = ref([
  {
    name: '类别一',
    instanceDistribution: {
      total: 2,
      segments: [
        { value: 1, color: '#1677FF', label: '训练集' }
      ]
    },
    imageDistribution: {
      total: 1,
      segments: [
        { value: 1, color: '#1677FF', label: '训练集' }
      ]
    }
  },
  {
    name: '类别二',
    instanceDistribution: {
      total: 2,
      segments: [
        { value: 2, color: '#F89117', label: '验证集' }
      ]
    },
    imageDistribution: {
      total: 1,
      segments: [
        { value: 1, color: '#F89117', label: '验证集' }
      ]
    }
  },
  {
    name: '未标注的图像',
    instanceDistribution: {
      total: 0,
      segments: []
    },
    imageDistribution: {
      total: 1,
      segments: [
        { value: 0.3, color: '#1677FF', label: '训练集' },
        { value: 0.3, color: '#F89117', label: '验证集' },
        { value: 0.4, color: '#00ABA8', label: '测试集' }
      ]
    }
  },
  {
    name: '类别三',
    instanceDistribution: {
      total: 2,
      segments: [
        { value: 2, color: '#1677FF', label: '训练集' }
      ]
    },
    imageDistribution: {
      total: 1,
      segments: [
        { value: 1, color: '#1677FF', label: '训练集' }
      ]
    }
  },
  {
    name: '类别四',
    instanceDistribution: {
      total: 2,
      segments: [
        { value: 2, color: '#F89117', label: '验证集' }
      ]
    },
    imageDistribution: {
      total: 1,
      segments: [
        { value: 1, color: '#F89117', label: '验证集' }
      ]
    }
  },
  {
    name: '未标注的图像',
    instanceDistribution: {
      total: 0,
      segments: []
    },
    imageDistribution: {
      total: 1,
      segments: [
        { value: 0.3, color: '#1677FF', label: '训练集' },
        { value: 0.3, color: '#F89117', label: '验证集' },
        { value: 0.4, color: '#00ABA8', label: '测试集' }
      ]
    }
  }
])

// 设置饼图 ref
const setPieRef = (el, index) => {
  if (el) {
    pieRefs.value[index] = el
  }
}

onMounted(() => {
  nextTick(() => {
    initAllPies()
  })
  // 添加全局点击事件监听器
  document.addEventListener('click', handleClickOutside)
  
  // 添加滚动事件监听器，当列表滚动时关闭弹出框
  const splitBox = document.querySelector('.split_box')
  if (splitBox) {
    splitBox.addEventListener('scroll', closePopconfirm)
  }
})

onUnmounted(() => {
  // 清理全局点击事件监听器
  document.removeEventListener('click', handleClickOutside)
  
  // 清理滚动事件监听器
  const splitBox = document.querySelector('.split_box')
  if (splitBox) {
    splitBox.removeEventListener('scroll', closePopconfirm)
  }
})

// 处理点击外部区域关闭popconfirm
const handleClickOutside = (event) => {
  const popconfirm = document.querySelector('.custom-popconfirm')
  const commentImgs = document.querySelectorAll('.comment-img')

  if (showPopconfirm.value >= 0 && popconfirm) {
    let clickedOnCommentImg = false
    commentImgs.forEach(img => {
      if (img.contains(event.target)) {
        clickedOnCommentImg = true
      }
    })

    if (!popconfirm.contains(event.target) && !clickedOnCommentImg) {
      closePopconfirm()
    }
  }
}

// 初始化所有饼图
const initAllPies = () => {
  pieRefs.value.forEach((pieElement, index) => {
    if (pieElement && splitData.value[index]) {
      initPie(pieElement, splitData.value[index].chartData)
    }
  })
  // 初始化右侧饼图
  if (rightPieRef.value) {
    initPie(rightPieRef.value, rightPieData.value)
  }
}

// 初始化弹窗饼图
const initDialogPie = () => {
  if (dialogPieRef.value) {
    // 如果已经存在图表实例，先销毁
    if (dialogPieRef.value._chartInstance) {
      dialogPieRef.value._chartInstance.dispose()
    }

    const myChart = echarts.init(dialogPieRef.value)
    // 将图表实例保存到DOM元素上，便于后续清理
    dialogPieRef.value._chartInstance = myChart

    const option = {
      legend: {
        orient: 'vertical',
        right: 10,
        bottom: 10,
        icon: 'circle',
        textStyle: {
          fontSize: 10,
          color: '#666'
        },
        itemWidth: 8,
        itemHeight: 8,
        itemGap: 4
      },
      series: [
        {
          type: 'pie',
          radius: ['48%', '80%'], // 环形饼图
          center: ['40%', '50%'],
          data: dialogPieData.value.map(item => ({
            value: item.value,
            name: item.name,
            itemStyle: {
              color: item.color
            }
          })),
          label: {
            show: false // 隐藏标签
          },
          labelLine: {
            show: false // 隐藏标签线
          },
          emphasis: {
            scale: false // 禁用鼠标悬停放大效果
          }
        }
      ]
    }

    myChart.setOption(option)

    // 响应式调整
    const resizeHandler = () => {
      myChart.resize()
    }
    window.addEventListener('resize', resizeHandler)

    // 保存resize处理器，便于清理
    dialogPieRef.value._resizeHandler = resizeHandler
  }
}

// 初始化单个饼图
const initPie = (element, data) => {
  // 如果已经存在图表实例，先销毁
  if (element._chartInstance) {
    element._chartInstance.dispose()
  }

  const myChart = echarts.init(element)
  // 将图表实例保存到DOM元素上，便于后续清理
  element._chartInstance = myChart

  const option = {
    series: [
      {
        type: 'pie',
        radius: ['48%', '100%'], // 环形饼图
        center: ['50%', '50%'],
        data: data.map(item => ({
          value: item.value,
          name: item.name,
          itemStyle: {
            color: item.color
          }
        })),
        label: {
          show: false // 隐藏标签
        },
        labelLine: {
          show: false // 隐藏标签线
        },
        emphasis: {
          scale: false // 禁用鼠标悬停放大效果
        }
      }
    ]
  }

  myChart.setOption(option)

  // 响应式调整
  const resizeHandler = () => {
    myChart.resize()
  }
  window.addEventListener('resize', resizeHandler)

  // 保存resize处理器，便于清理
  element._resizeHandler = resizeHandler
}

// 计算进度条段的宽度百分比
const calculateSegmentWidth = (segment, total) => {
  if (total === 0) return 0
  return (segment.value / total) * 100
}

// 格式化显示数值
const formatDisplayValue = (segments) => {
  if (segments.length === 0) return '0'
  const total = segments.reduce((sum, seg) => sum + seg.value, 0)
  return Math.round(total).toString()
}

// 打开创建拆分弹窗
const carterSplit = () => {
  showSplitDialog.value = true
  // 弹窗显示后初始化饼图
  nextTick(() => {
    initDialogPie()
  })
}

const closeDialog = () => {
  showSplitDialog.value = false
}

// 处理comment图片点击事件
const handleCommentClick = (index, event) => {
  // 切换弹出框显示状态
  showPopconfirm.value = showPopconfirm.value === index ? -1 : index
  
  // 如果是显示弹出框，则计算位置
  if (showPopconfirm.value === index) {
    // 获取点击位置
    const { clientX, clientY } = event
    // 获取页面滚动位置
    const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
    const scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft
    
    // 设置弹出框位置（相对于文档）
    popconfirmPosition.value = {
      top: clientY + scrollTop + 10, // 向下偏移10px
      left: clientX + scrollLeft + 10 // 向右偏移10px
    }
  }
}

// 关闭popconfirm
const closePopconfirm = () => {
  showPopconfirm.value = -1
}
</script>
<style scoped lang="scss">
.content_box {
  height: calc(100% - 7px);
  padding: 7px 15px 0 15px;
  display: flex;

  .content_left {
    flex-shrink: 0;
    width: 235px;
    display: flex;
    flex-direction: column;
    margin-right: 11px;

    .content_left_title {
      padding: 0 15px;
      line-height: 50px;
      margin-bottom: 10px;
      font-size: 14px;
    }

    .content_left_ul {
      flex: 1;

      .header {
        display: flex;
        align-items: center;
        padding: 14px 15px;
        border-bottom: 1px solid rgba(117, 138, 179, 0.2);

        img {
          margin-right: 10px;
          width: 38px;
          height: 35px;
          border-radius: 50%;
        }

        .header_title {
          div:nth-child(1) {
            font-weight: 400;
            font-size: 14px;
            color: #333333;
            line-height: 21px;
            margin-bottom: 4px;
          }

          div:nth-child(2) {
            font-weight: 400;
            font-size: 12px;
            color: #606266;
            line-height: 18px;
          }
        }
      }

      .split_box {
        padding: 0 15px 14px 15px;
        max-height: 600px;
        overflow-y: auto;

        // 自定义滚动条样式
        &::-webkit-scrollbar {
          width: 6px;
        }

        &::-webkit-scrollbar-track {
          background: rgba(0, 0, 0, 0.1);
          border-radius: 3px;
        }

        &::-webkit-scrollbar-thumb {
          background: rgba(0, 0, 0, 0.3);
          border-radius: 3px;

          &:hover {
            background: rgba(0, 0, 0, 0.5);
          }
        }

        .split_title {
          font-weight: 400;
          font-size: 14px;
          color: #222222;
          line-height: 20px;
        }

        .carter_split {
          cursor: pointer;
          margin-top: 10px;
          width: 100%;
          border: 1px solid #2165F8;
          border-radius: 22px;
          font-weight: 500;
          font-size: 14px;
          color: #2165F8;
          line-height: 40px;
          text-align: center;
        }

        .split_item {
          margin-top: 14px;
          background: rgba(255, 255, 255, 0.79);
          border-radius: 8px;
          border: 1px solid #DCE5E6;
          padding: 14px 10px 16px 14px;

          .split_item_title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 18px;

            div:nth-child(1) {
              font-weight: 400;
              font-size: 12px;
              color: #333333;
              line-height: 12px;
            }

            .split_item_actions {
              position: relative;
              display: flex;
              align-items: center;

              .comment-img {
                cursor: pointer;
                width: 12px;
                height: 12px;
                margin-right: 16px;
              }

              img:nth-child(2) {
                cursor: pointer;
                width: 12px;
                height: 3px;
              }

              .custom-popconfirm {
                position: fixed; // 改为fixed定位，相对于视口
                top: v-bind('popconfirmPosition.top + "px"'); // 使用动态计算的位置
                left: v-bind('popconfirmPosition.left + "px"'); // 使用动态计算的位置
                background: rgba(0, 0, 0, 0.75);
                border-radius: 6px;
                z-index: 1000;

                .popconfirm-arrow {
                  position: absolute;
                  top: 10px; // 距离上边10px
                  left: -6px; // 在popconfirm左侧
                  width: 0;
                  height: 0;
                  border-top: 6px solid transparent;
                  border-bottom: 6px solid transparent;
                  border-right: 6px solid rgba(0, 0, 0, 0.75); // 向左指向的三角箭头
                }

                .popconfirm-content {
                  padding: 10px 21px 13px 19px;

                  .popconfirm-content-title {
                    font-weight: 400;
                    font-size: 14px;
                    color: #FFFFFF;
                    line-height: 22px;
                    margin-bottom: 8px;
                  }

                  .popconfirm-content-txt {
                    width: 304px;
                    height: 80px;
                    padding: 8px 12px;
                    background: #FFFFFF;
                    border-radius: 6px;
                    border: 1px solid rgba(255, 255, 255, 0.2);
                    font-weight: 400;
                    font-size: 14px;
                  }

                  .popconfirm-content-btn {
                    display: flex;
                    align-items: center;
                    justify-content: end;
                    gap: 15px;
                    font-weight: 400;
                    font-size: 14px;
                    margin-top: 15px;

                    &-cancel {
                      background: #FFFFFF;
                      border-radius: 4px;
                      border: 1px solid rgba(0, 0, 0, 0.15);
                      color: rgba(0, 0, 0, 0.88);
                      line-height: 24px;
                      padding: 0 8px;
                      cursor: pointer;
                    }

                    &-submit {
                      background: #1677FF;
                      border-radius: 4px;
                      border: 1px solid #1677FF;
                      color: #FFFFFF;
                      line-height: 24px;
                      padding: 0 8px;
                      cursor: pointer;
                    }
                  }
                }
              }
            }
          }

          .split_s {
            display: flex;
            align-items: center;

            .split_pie {
              width: 70px;
              height: 70px;
              flex-shrink: 0;
              margin-right: 10px;
            }

            .split_txt {
              display: flex;
              flex-direction: column;
              justify-content: space-between;
              font-size: 12px;
              color: #8C8C8C;
            }
          }
        }
      }
    }
  }

  .content_right {
    flex: 1;
    display: flex;
    flex-direction: column;

    .content_right_title {
      font-weight: 500;
      font-size: 14px;
      color: #303133;
      line-height: 14px;
    }

    .content_right_top {
      display: flex;
      gap: 10px;

      .content_right_top_left {
        flex: 1;
        padding: 17px 15px 18px 14px;

        .content_right_form {
          display: flex;
          align-items: center;
          margin-top: 20px;

          .label {
            font-weight: 400;
            font-size: 14px;
            color: #333333;
            line-height: 14px;
            margin-right: 6px;
          }

          input {
            flex: 1;
            border-radius: 6px;
            border: 1px solid rgba(0, 0, 0, 0.15);
            line-height: 20px;
            padding: 5px 12px;
            font-size: 14px;
            color: rgba(0, 0, 0, 0.88);
          }
        }

        .content_right_top_left_s {
          display: flex;
          align-items: center;
          margin-top: 20px;
          padding: 0 28px 0 20px;

          .content_right_table {
            flex: 1;

            .thead {
              display: flex;
              align-items: center;
              line-height: 20px;
              background: rgba(0, 0, 0, 0.04);
              border-radius: 6px;
              text-align: center;
              font-weight: 400;
              font-size: 10px;
              color: #606266;

              div {
                flex: 1;
              }
            }

            .scroll_h {
              height: 70px;
              overflow-y: auto;
              margin-bottom: 12px;

              &::-webkit-scrollbar {
                display: none;
              }

              scrollbar-width: none;
              -ms-overflow-style: none;

              .tr {
                margin-top: 12px;
                display: flex;
                align-items: center;
                text-align: center;
                line-height: 12px;
                font-weight: 500;
                font-size: 12px;
                color: #303133;

                div {
                  flex: 1;
                }
              }
            }
          }

          .content_right_top_left_pie {
            width: 100px;
            height: 100px;
            flex-shrink: 0;
            margin-left: 80px;
          }

        }
      }

      .content_right_top_right {
        flex: 1;
        padding: 17px 14px 12px 14px;

        .content_right_top_right_table_thead {
          margin-top: 20px;
          display: flex;
          align-items: center;
          line-height: 20px;
          background: rgba(0, 0, 0, 0.04);
          border-radius: 6px;
          text-align: center;
          font-weight: 400;
          font-size: 10px;
          color: #606266;

          div {
            flex: 1;
          }

        }

        .scroll_h {
          height: 84px;
          overflow-y: auto;
          margin-bottom: 12px;

          &::-webkit-scrollbar {
            display: none;
          }

          scrollbar-width: none;
          -ms-overflow-style: none;

          .tr {
            margin-top: 12px;
            display: flex;
            align-items: center;
            text-align: center;
            line-height: 12px;
            font-weight: 500;
            font-size: 12px;
            color: #303133;

            div {
              flex: 1;
            }
          }
        }

        .tip_err {
          margin-top: 36px;
          display: flex;
          align-items: center;
          line-height: 30px;
          text-align: center;
          background: #FFF1F0;
          border-radius: 6px;
          border: 1px solid #FFCCC7;

          img {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
            margin-right: 5px;
            margin-left: 9px;
          }

          .tip_err_txt {
            font-weight: 400;
            font-size: 12px;
            color: rgba(0, 0, 0, 0.88);
          }
        }
      }
    }

    .content_bottom {
      flex: 1;
      padding: 17px 14px;
      margin-top: 10px;

      .content_bottom_thead {
        margin-top: 16px;
        display: flex;
        text-align: center;
        line-height: 20px;
        background: rgba(0, 0, 0, 0.04);
        border-radius: 6px;
        font-weight: 400;
        color: #606266;

        .flex1 {
          flex: 1;
          display: flex;
          align-items: center;
          justify-content: center;

          div:nth-child(1) {
            font-size: 10px;
            margin-right: 7px;
          }
        }
      }

      .ov_h {
        max-height: 450px;
        overflow-y: auto;
      }

      .content_bottom_tr {
        display: flex;
        align-items: center;
        padding: 10px 0;

        &:last-child {
          border-bottom: none;
        }

        .category_name {
          flex: 1;
          font-weight: 400;
          font-size: 12px;
          color: #303133;
          text-align: center;
        }

        .distribution_column {
          flex: 1;
          display: flex;
          align-items: center;
          justify-content: center;
          gap: 10px;

          .distribution_value {
            font-weight: 500;
            font-size: 12px;
            color: #303133;
            text-align: center;
          }

          .progress_bar_container {
            width: 80%;
            max-width: 200px;

            .progress_bar {
              width: 100%;
              height: 8px;
              background-color: #F5F5F5;
              border-radius: 4px;
              overflow: hidden;
              display: flex;
              position: relative;

              .progress_segment {
                height: 100%;
                transition: all 0.3s ease;

                &:first-child {
                  border-radius: 4px 0 0 4px;
                }

                &:last-child {
                  border-radius: 0 4px 4px 0;
                }

                &:only-child {
                  border-radius: 4px;
                }

                &:hover {
                  opacity: 0.8;
                }
              }

              // 空状态样式
              &:empty::after {
                content: '';
                width: 100%;
                height: 100%;
                background-color: #F5F5F5;
                display: block;
              }
            }
          }
        }
      }
    }
  }
}

.split_dialog {

  .dialog_form {
    div {
      font-weight: 400;
      font-size: 14px;
      color: #333333;
      line-height: 14px;
    }

    input {
      margin-top: 20px;
      width: 400px;
      border-radius: 6px;
      border: 1px solid rgba(0, 0, 0, 0.15);
      line-height: 20px;
      padding: 5px 12px;
      font-size: 14px;
      color: rgba(0, 0, 0, 0.88);
    }
  }

  .dialog_center {
    display: flex;
    margin-top: 57px;

    .dialog_center_pie {
      width: 200px;
      height: 160px;
      flex-shrink: 0;
      margin-right: 40px;
    }

    .dialog_center_right {
      width: 261px;

      .dialog_center_right_st {
        display: flex;
        justify-content: space-between;
        font-weight: 400;
        font-size: 14px;
        color: #333333;
        line-height: 14px;
        margin-bottom: 14px;
      }

      .dialog_center_table {

        .dialog_center_table_th {
          display: flex;
          align-items: center;
          text-align: center;
          width: 260px;
          background: rgba(0, 0, 0, 0.04);
          border-radius: 6px;
          line-height: 20px;
          margin-bottom: 14px;

          div {
            flex: 1;
            font-weight: 400;
            font-size: 10px;
            color: #606266;
          }
        }

        .dialog_center_table_td {
          display: flex;
          margin-bottom: 10px;
        }
      }
    }
  }


  .dialog_center_table_item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px 0px 0px 2px;

    .jian {
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #BFBFBF;
      border-right: unset;
      cursor: pointer;
      border-radius: 2px 0px 0px 2px;

      img {
        width: 8px;
        height: 1px;
      }
    }

    .num {
      text-align: center;
      border: 1px solid #BFBFBF;
      width: 30px;
      line-height: 18px;
      font-weight: 400;
      font-size: 10px;
      color: #333333;
    }

    .jia {
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #BFBFBF;
      border-left: unset;
      cursor: pointer;
      border-radius: 0px 2px 2px 0px;

      img {
        width: 8px;
        height: 8px;
      }
    }
  }

  .dialog_setting {
    display: flex;
    align-items: center;

    .label {
      margin-right: 14px;
      margin-left: 4px;
      font-weight: 400;
      font-size: 12px;
      color: #606266;
      line-height: 12px;
    }

    .dialog_center_table_item {
      flex: 0;
    }
  }

  .dialog_footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    font-size: 16px;
    font-weight: 400;
    margin-top: 16px;

    .dialog_footer_cancel {
      padding: 0 34px;
      line-height: 40px;
      background: #FFFFFF;
      border-radius: 8px;
      border: 1px solid rgba(0, 0, 0, 0.15);
      color: rgba(0, 0, 0, 0.88);
      cursor: pointer;
    }

    .dialog_footer_carter {
      padding: 0 16px;
      line-height: 40px;
      background: #1677FF;
      border: 1px solid #1677FF;
      border-radius: 8px;
      color: #FFFFFF;
      cursor: pointer;
    }
  }
}
</style>